function [ A, B ] = FourierMod( x, y, T, ifgpu )
%FourierMod presents 
%   http://adsabs.harvard.edu/abs/1982ApJ...263..835S
% x=x(:);
% y=y(:);
% T=T(:)';
    if ifgpu
        gones =gpuArray(ones(length(x),1));
        gonest=gpuArray(ones(1,length(T)));
    else
        gones =(ones(length(x),1));
        gonest=(ones(1,length(T)));
    end
    tempa=cos(2*pi*x*ones(1,length(T))./(gones*T));
    tempb=sin(2*pi*x*ones(1,length(T))./(gones*T));
    A=sum(y*gonest.*tempa).^2./...
      sum(  tempa.^2);
    B=sum(y*gonest.*tempb).^2./...
      sum(  tempb.^2);

end

